package com.oms.web.controller.order;

import com.oms.common.core.controller.BaseController;
import com.oms.common.core.domain.AjaxResult;
import com.oms.system.domain.OmsOrderProduct;
import com.oms.system.service.IOmsOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Api(tags = "用户查询订单页面方法")
@Controller
@RequestMapping("/order/face")
public class UserFaceController extends BaseController {

    @Resource
    private IOmsOrderService orderService;

    private String prefix = "order/";

    @ApiOperation(value = "", hidden = true)
    @GetMapping("/user")
    public String index(){
        return prefix + "user";
    }

    @ApiOperation(value = "", hidden = true)
    @GetMapping("/orderInfo")
    public String orderInfo(){
        return prefix + "orderInfo";
    }

    @ApiOperation(value = "根据密码查询订单详情")
    @GetMapping("/orderDetailByUniCode")
    @ResponseBody
    public AjaxResult getOrderDetailByUniCode(Long orderId,
                                              String uniCode,
                                              @RequestParam(required = false) String userName){
        OmsOrderProduct omsOrderProduct = orderService.getOrderProductByUniCode(orderId, uniCode, userName);
        return AjaxResult.success(omsOrderProduct);
    }

}
